<template>
  <div>
    <image class="bgimg" src="root:img/bg.png" resize="cover" />
    <scroller class="wrappers">
      <text class="emailtitle">Verification code</text>
      <div class="inputBox bb">
        <input
          type="text"
          v-model="vertify"
          class="input"
          maxlength="6"
          placeholder="SMS Verification code"
          placeholder-color="#F2f2f2"
        />
      </div>
      <text class="singnIn" @click="next">Next step</text>
    </scroller>
    <div v-if="loading" class="mask" @click="event=> event.stopPropagation()">
      <floading class="indicator" color="#303030"></floading>
    </div>
  </div>
</template>

<script>
const pref = weex.requireModule("storage");
import { bind_mobile } from "../../mixin/ajax.js";
export default {
  data() {
    return {
      loading: false,
      vertify: "",
      loginType: "email"
    };
  },
  created() {
    let that = this;
    pref.getItem("users_id", res => {
      if (res.result == "success") {
        that.users_id = res.data;
      }
    });
  },
  methods: {
    onLoad(parmars) {
     
      if (parmars && parmars.phone) {
        this.phone = parmars.phone;
      }
    },
    next() {
      if (!this.vertify) {
        this.toast("Enter vertify");
        return false;
      }
      this.loading = true;
      bind_mobile(
        {
          users_id: this.users_id,
          phone_number: this.phone,
          verify: this.vertify
        },
        (res, flag) => {
          this.loading = false;
         
          if (flag) {
            this.toast(res.message);
            if (res.code == 200) {
              setTimeout(() => {
                this.push("root:inedx.js");
              }, 1000);
            }
          }
        }
      );
    }
  }
};
</script>

<style scoped>
.bgimg {
  flex: 1;
}

.iconfont {
  font-family: iconfont;
}

.inputIcon {
  font-size: 30px;
  color: #ffffff;
  width: 60px;
  text-align: left;
}

.wrappes {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  right: 0;
  color: #ffffff;
  justify-content: flex-start;
  align-items: center;
}

.emailtitle {
  color: #ffffff;
  font-size: 48px;
  margin-top: 167px;
  height: 200px;
  width: 556px;
  text-align: left;
}

.wrappers {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  right: 0;
  color: #ffffff;
  justify-content: flex-start;
  align-items: center;
  width: 750px;
}

.input {
  flex: 1;
  height: 60px;
  padding-left: 5px;
  color: #ffffff;
  font-size: 30px;
  background-color: transparent;
}

.inputBox {
  margin-top: 40px;
  height: 80px;
  width: 556px;
  flex-direction: row;
  align-items: flex-end;
  padding-bottom: 2px;
}

.phoneType {
  height: 60px;
  color: #ffffff;
  line-height: 60px;
  font-size: 30px;
  margin-right: 20px;
}

.codeBtn {
  height: 60px;
  color: #ffffff;
  line-height: 60px;
  font-size: 30px;
}

.radioBox {
  flex-direction: row;
  margin-top: 32px;
  justify-content: flex-start;
  align-items: center;
  width: 556px;
  height: 40px;
}

.radio {
  color: #ffffff;
  font-size: 34px;
  margin-right: 20px;
}

.loginType {
  color: #ffffff;
  font-size: 26px;
}

.logintip {
  font-size: 22px;
  margin-top: 32px;
  height: 30px;
  line-height: 30px;
  color: #ffffff;
  margin-bottom: 220px;
}

.logintiphone {
  font-size: 22px;
  margin-top: 32px;
  height: 30px;
  line-height: 30px;
  color: #ffffff;
  margin-bottom: 100px;
}

.singnIn {
  width: 580px;
  height: 80px;
  border-radius: 40px;
  background-color: #ffffff;
  color: #303030;
  text-align: center;
  line-height: 80px;
  font-size: 28px;
  margin-top: 102px;
}

.singnIn:active {
  background-color: #f3f3f3;
}

.rowBox {
  flex-direction: row;
  align-items: center;
  justify-content: center;
}

.br {
  border-right-color: #ffffff;
  border-right-width: 1px;
  border-right-style: solid;
}

.bb {
  border-bottom-color: #ffffff;
  border-bottom-width: 1px;
  border-bottom-style: solid;
}

.boxItem {
  font-size: 32px;
  color: #ffffff;
  text-align: center;
}

.ccc {
  color: #cccccc;
}

.mask {
  position: fixed;
  left: 0;
  bottom: 0;
  top: 0;
  right: 0;
  justify-content: center;
  align-items: center;
  background-color: transparent;
}

.indicator {
  width: 40px;
  height: 40px;
}
</style>
